﻿using System;
using FFIV.Lib.IView.Articles;
using FFIV.Lib.Utilities;

public partial class Views_Articles_ArticleDetails : System.Web.UI.UserControl, IArticleDetails
{
	private int m_ArticleId;
	private Guid m_AuchorId;

	public string Title
	{
		set
		{
			lt_Title.InnerText = value;
			lit_MainTitle.Text = value.Length > 20? value.Substring(0, 20) + "..." : value;
		}
	}

	public string Author
	{
		set { lt_Author.Text = value; }
	}

	public string Tags
	{
		set { lt_Tags.Text = value; }
	}

	public int CategoryId
	{
		set { lt_Category.HRef = UrlUtility.GetCategoriesUrl(value); }
	}

	public DateTime LastUpdateDate
	{
		set
		{
			DateTime time = value;
			lt_LastUpdateDate.Text = time.ToString("yyyy-MM-dd");
		}
	}

	public string CategoryName
	{
		set { lt_Category.InnerText = value; }
	}

	public Guid AuthorId
	{
		set { m_AuchorId = value; }
	}

	public int ArticleId
	{
		set { m_ArticleId = value; }
	}

	public bool IsEditable
	{
		set
		{
			if (value)
			{
				lkb_Edit.HRef = UrlUtility.GetArticleEditUrl(m_ArticleId);
				lkb_Edit.Visible = true;
			}
			else
			{
				lkb_Edit.HRef = "#";
				lkb_Edit.Visible = false;
			}
		}
	}

	public string Content
	{
		set { lt_Content.Text = value; }
	}
}
